package gameEngine.agents.Logger;

public class TXTLogger extends textLogger {

	double score;
	
	/**
	 * uses {@link textLogger}constructor to create a txt file
	 * @param gameNum
	 */
	public TXTLogger(int gameNum) {
		super("txt",gameNum);
	}

	/**
	 * writes remaining text to file and close stream
	 */
	public void flush(){
		counter=0;
		try{
			// Create file 
			out.write(str);
			//write the total score
			out.write("\n game total score was  "+score);
			//Close the output stream
			out.close();
			log.debug("done writing a buffer");
		}catch (Exception e){//Catch exception if any
			log.debug("writing log failed\n"+ e.getMessage());
		}
		str="";
	}
	
	public void setScore(double score){
		this.score=score;
	}
	
}
